package top.suven.base.http.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName:
 * @Description:
 * @Author aric
 * @Date 2018/5/29 下午4:10
 * @Copyright: (c) 2018 gc by https://www.gc.com.cn/
 * @Version : 1.0.0
 * --------------------------------------------------------
 * modifyer    modifyTime                 comment
 * <p>
 * --------------------------------------------------------
 */
public enum SourceEnumType {
    SOURCE_REDFINGER("com.redfinger.app","红手指官网来源"),
    SOURCE_EXPERIENCE("experience.system","体验设备来源"),
    SOURCE_SCHEDULE("schedule.system","设备来源"),
    SOURCE_ACTIVATION("activation.system","激活码来源"),
    SOURCE_POJIE("com.redfinger.app.pojie","破解版来源"),
    SOURCE_APPSTORE("com.redfinger.app.appstore","IOS商城");

    private String code;
    private String name;

    SourceEnumType(String code, String name) {
        this.name = name;
        this.code = code;
    }

    private static Map<String,SourceEnumType> enumMap = new HashMap<>();
    static {
        for(SourceEnumType enumType : values()) {
            enumMap.put(enumType.code, enumType);
        }
    }

    public static String getNameByCode(String code) {
        SourceEnumType enumType =  enumMap.get(code);
        if(null != enumType){
            return   enumType.name;
        }
        throw new IllegalArgumentException("No element matches " + code);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }



}
